package homework.demo03;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *@author 2010404112黄敬  2010404122王思毅
 * @author Administrator
 */
public class CheckIdNumber {
    
    public static void main(String[] args) {
        String IdNumber ="000000000000000000";
        boolean flag=true;
        if(IdNumber.length()!=18){
            flag =false;
        }
        
        String numstr="0123456789X";
        for(int i=0;i<IdNumber.length();i++){
            char c=IdNumber.charAt(i);
            int temp=numstr.indexOf(c);
            if(temp<0){
                flag=false;
                break;
            }
        }
        if(flag)
        {
            System.out.println("是合法的身份证号码");
        }
        else
        {
            System.out.println("不是合法的身份证号码");
        }

    }
}


